<?php

/**
 * 
 * @author truonghm
 * @version $1.0
 * @date 06/04/2011
 *
 */

class Models_Form extends Zend_Db_Table_Abstract {
	protected $_name = 'form';
	protected $_primary = 'id';
	
	/**
	 * @author truonghm
	 * @date 06/04/2011
	 * @desc get thong tin cau hinh form trong database	 
	 */
	public function getColumnName($p_formKey){

		$lbl_formConfig = new Models_FormConfig();
		
		$vc_select = $this->select()
							  ->setIntegrityCheck(false)
							  ->from(array("f"=>$this->info("name")) ,array("f.table_name"))
							  ->joinInner(array("fc"=>$lbl_formConfig->info("name")),"f.id = fc.from_id",array("fc.*"))
							  ->where("f.code=?",$p_formKey);
		//echo $vc_select;							  
		$arr_data = $this->fetchAll($vc_select);
		
		//khong co du lieu cau hinh reader va column
		if(!$arr_data) return;	
			
		$arr_cols=$arr_data->toArray();
		
		return Zend_Json::encode($arr_cols);	
	}
}
?>